home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / Time.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.7 KB  |  86 lines

  1. /* Interface for Objective-C Time object
  2.    Copyright (C) 1993,1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: May 1993
  6.  
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */ 
  23.  
  24. /* This is a combination of Smalltalk's Time and Date objects */
  25.  
  26. #ifndef __Time_h_OBJECTS_INCLUDE
  27. #define __Time_h_OBJECTS_INCLUDE
  28.  
  29. #include <objects/stdobjects.h>
  30. #include <objects/Magnitude.h>
  31. #include <sys/time.h>
  32. #include <sys/resource.h>
  33.  
  34. @interface Time : Magnitude
  35. {
  36.   struct timeval tv;        /* seconds and useconds */
  37.   struct timezone tz;        /* minutes from Greenwich, and correction */
  38. }
  39.  
  40. /* Change these names? */
  41. + (long) secondClockValue;
  42. + getClockValueSeconds: (long *)sec microseconds: (long *)usec;
  43.  
  44. + (long) millisecondsToRun: (void(*)())aFunc;
  45. + getSeconds: (long *)sec microseconds: (long *)usec toRun: (void(*)())aFunc;
  46.  
  47. + (unsigned) indexOfDayName: (const char *)dayName;
  48. + (const char *) nameOfDayIndex: (unsigned)dayIndex;
  49. + (unsigned) indexOfMonthName: (const char *)monthName;
  50. + (const char *) nameOfMonthIndex: (unsigned)monthIndex;
  51. + (unsigned) daysInMonthIndex: (unsigned)monthIndex forYear: (unsigned)year;
  52. + (unsigned) daysInYear: (unsigned)year;
  53. + (BOOL) leapYear: (unsigned)year;
  54.  
  55. - initNow;
  56. - initDayIndex: (unsigned)dayIndex 
  57.     monthIndex: (unsigned)monthIndex 
  58.     year: (unsigned)year;
  59. - initSeconds: (long)numSeconds microseconds: (long)numMicroseconds;
  60. - initSeconds: (long)numSeconds;
  61.  
  62. - setSeconds: (long)numSeconds microseconds: (long)numMicroseconds;
  63. - setSeconds: (long)numSeconds;
  64.  
  65. - (long) days;
  66. - (long) hours;
  67. - (long) minutes;
  68. - (long) seconds;
  69. - (long) microseconds;
  70.  
  71. - addTime: (Time*)aTimeObj;
  72. - addDays: (unsigned)num;
  73. - addHours: (unsigned)num;
  74. - addMinutes: (unsigned)num;
  75. - addSeconds: (unsigned)num;
  76.  
  77. - subtractTime: (Time*)aTimeObj;
  78. - subtractDays: (unsigned)num;
  79. - subtractHours: (unsigned)num;
  80. - subtractMinutes: (unsigned)num;
  81. - subtractSeconds: (unsigned)num;
  82.  
  83. @end
  84.  
  85. #endif /* __Time_h_OBJECTS_INCLUDE */
  86.